import { Sequelize } from 'sequelize';

const sequelize = new Sequelize('block', 'root', 'root', {
  dialect: 'mysql',
  host: 'localhost',
  port: 3306,
  logging(msg: any) {
    if (msg instanceof Error) throw msg;
  },
  timezone: '+08:00',
  define: {
    timestamps: true,
    paranoid: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at',
    deletedAt: 'deleted_at',
    underscored: true,
    freezeTableName: true,
    /*     scopes: {
      bh: {
        attributes: {
          exclude: ['updated_at', 'deleted_at', 'created_at'],
        },
      },
    }, */
  },
});

sequelize.sync({
  force: false,
});

export default sequelize;
